
/**
 * 
 * @param win
 * @returns {Reload}
 */
function Reload(win){
	if(!win){
		win = window;
	}
	this.win_ = win;
	this.params_ = {};
	var locationHref = this.win_.location.href;
	var paramsStr = "";
	var wIndex = locationHref.indexOf("\?");
	if(wIndex>0){
		var jIndex = locationHref.indexOf("\#");
		if(jIndex>0){
			paramsStr = locationHref.substring(wIndex+1,jIndex);
		}
		else{
			paramsStr = locationHref.substring(wIndex+1);
		}
		paramsStr = '{"'+paramsStr.replace(/\&/g,'","').replace(/\=/g,'":"')+'"}';
		eval("this.params_="+paramsStr);
	}
}
Reload.prototype.getParams = function (){
	return this.params;
};
Reload.prototype.addParam = function (key, value){
	eval("this.params_['"+key+"']=encodeURIComponent('"+value+"')");
};
Reload.prototype.removeParam = function (key){
	eval("this.params_['"+key+"']= undefined");
};
Reload.prototype.getParam = function (key){
	var param = decodeURIComponent(this.params_[key]);
	if (param == 'undefined') {
		param = null;
	}
	return param;
};
Reload.prototype.reload = function (){
	var vars = "";
	for(var key in this.params_){
		if(undefined!=this.params_[key]){
			vars+=(vars==""?"":"&")+key+"="+this.params_[key];
		}
	}
	var href = this.win_.location.href;
	if(href.indexOf("\?")>0){
		href = href.substring(0,href.indexOf("\?"));
	}
	else if(href.indexOf("\#")>0){
		href = href.substring(0,href.indexOf("\#"));
	}
	if(vars){
		this.win_.location.href = href+"?"+vars;
	}
	else{
		this.win_.location.href = href;
	}
	
};

var pageReload = new  Reload();
$(document).ready(function() {
	//mo_yq5	注册事件：点击分页
	$("#pageLink").find("a[class!='cur']").click(function(){
			pageReload.addParam("nowPage", $(this).attr("page"));
			pageReload.reload();
		});
});